﻿@model IEnumerable<KRM.Core.tblCompany>
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<script src="~/js/contact.js"></script>

<div class="container-fluid">
    <div id="divViewDetails" class="modal hide fade" tabindex="-1" data-width="1000">
        <div class="modal-body" id="ViewDetails" style="max-height: 500px;">
            <div class="ajax-loading"></div>
        </div>
    </div>

    <fieldset>
        <legend>Search</legend>
        <div class="row-fluid">
            <div class="span4">
                <div class="row-fluid">
                    <div class="span4">
                        <label class="inline">Company Name</label>
                    </div>
                    <div class="span8">
                        <input type="text" name="CompanyName" id="CompanyName" class="input-block-level" value="">
                    </div>
                </div>
            </div>
            <div class="span4">
                <button onclick="filterCompany()" class="btn btn-primary">Search</button>
            </div>
            <div class="span4">
                <label class="checkbox">
                    <input onchange="filterCompany()" type="checkbox" id="cbArchive" name="viewArchive" value="1">
                    View Archived Companies
                </label>
            </div>
        </div>
    </fieldset>

    <div class="fieldset">
        <div class="legend"><span>List Company</span></div>
        <div id="divListCompany">
            <table class="table table-bordered table-fix krmtable" id="tableCompany" data-height="450">
                <thead>
                    <tr>
                        <th>Details</th>
                        <th>Company Name</th>
                        <th>Email</th>
                        <th>Contact</th>
                        <th>Telephone</th>
                        <th>Telephone2</th>
                        <th>Fax</th>
                        <th>Mobile Number</th>
                        <th>Archive</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (var item in Model)
                    {
                        <tr style="cursor: pointer;" class="archive@(item.Archive == true ? 1 : 0)">
                            <td><a onclick="ViewCompanyDetails(@item.CompanyID)" class="btn btn-primary" data-toggle="modal" href="#divViewDetails"><i class="icon-file-alt"></i>View</a></td>
                            <td>@item.CompanyName</td>
                            <td>@item.Email</td>
                            <td>@item.Contact</td>
                            <td>@item.Telephone</td>
                            <td>@item.Telephone2</td>
                            <td>@item.Fax</td>
                            <td>@item.MobileNumber</td>
                            <td>@item.Archive</td>
                        </tr>
                    }
                </tbody>
            </table>
        </div>
    </div>
</div>
